package com.thyme.user.controller.user;

import com.thyme.user.domain.entity.user.User;
import com.thyme.user.service.user.UserService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author thyme
 * @ClassName UserController
 * @Description TODO
 * @Date 2019/10/31 9:44
 */
@RestController
@RequestMapping("/users")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Slf4j
public class UserController {

    private final UserService userService;

    @GetMapping("/{id}")
    public User findById(@PathVariable Integer id) {
        log.info("我被请求了。。。");
        return userService.findById(id);
    }

    @GetMapping("/test")
    public User user(User user){
        return user;
    }
}
